fix(db): batch signal snapshot target lookups - #3465
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3465 +/- ##
=======================================
Coverage 93.47% 93.47%
=======================================
Files 292 292
Lines 30797 30800 +3
Branches 11225 11225
=======================================
+ Hits 28786 28789 +3
Misses 1355 1355
Partials 656 656
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 08:21:34 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Motivation
INparameter list that can exceed D1/back-end bound-parameter limits and fail the sweep, causing no per-repo refresh jobs to be enqueued.Description
SIGNAL_SNAPSHOT_TARGET_KEY_SQL_BATCH = 90and changelistLatestSignalSnapshotsForTargetsto iteratetargetKeysin batches and run one parametrized query per batch so bound-parameter counts stay bounded.target_key) and merge batch results into a single returnedMap<string, SignalSnapshotRecord>.test/unit/data-spine.test.tsthat seeds 95 keys, wraps the test DB to capture bound-parameter counts, and asserts the query was split into two batches ([91, 6], accounting forsignalTypeplus targets) while returning all results.src/db/repositories.tsandtest/unit/data-spine.test.ts.Testing
npx vitest run test/unit/data-spine.test.ts -t "listLatestSignalSnapshotsForTargets"and the updated unit test passed.npm run typecheckandgit diff --checkwhich both succeeded.npm run test:ci; the full suite did not complete in this environment due to unrelated long-running queue/backfill tests and externalactionlintsetup DNS issues, sotest:cidid not finish green here.npm audit --audit-level=moderatereturned a registry audit endpoint error (403) in this environment and could not be validated here.Codex Task